<script src="__LAYUI__/layui.js"></script>
<link href="__LAYUI__/css/layui.css" rel="stylesheet"/>
<form class="layui-form layui-form-pane" action="" style="margin: 50px">
    <fieldset class="layui-elem-field layui-field-title">
        <div class="layui-field-box">
            <div class="layui-form-item">
                <label class="layui-form-label">出版社名称</label>
                <div class="layui-input-block">
                    <input type="text" name="company_name" required  lay-verify="required" value="{$company_name}" placeholder="请输入出版社名称" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">出版社网址</label>
                <div class="layui-input-block">
                    <input type="text" name="company_url" required  lay-verify="required" value="{$company_url}" placeholder="请输入出版社网址" autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">出版社图片网址</label>
                <div class="layui-input-block">
                    <input type="text" name="company_logo" required  lay-verify="required" value="{$company_logo}" placeholder="请输入出版社图片网址" autocomplete="off" class="layui-input">
                </div>
            </div>

            <input type="hidden" name="company_id" value="{$company_id}">

            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit="" lay-filter="demo1">修改</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </div>
    </fieldset>

</form>
<script>
    layui.use(['form','jquery','laydate'],function () {
        var form = layui.form,
            $ = layui.$,
            laydat = layui.laydate;

        laydat.render({
            elem: '#date'
        });

        form.on('submit(demo1)', function(data){
            $.post('/index/company/updateCompany',data.field,function (res) {
                layer.msg(res.msg, {
                    icon: 1,
                    time: 3000 //2秒关闭（如果不配置，默认是3秒）
                });
                if(res.code){
                    parent.location.reload();
                    var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                    parent.layer.close(index); //再执行关闭
                }
            })

            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });
    })
</script>